﻿#include "Config.hpp"

#include <iomanip>
#include <sstream>

namespace TDesign::Theme
{
    std::string ColorsEnumToHexStr(uint32_t color)
    {
        uint8_t r = (color >> 24) & 0xFF;
        uint8_t g = (color >> 16) & 0xFF;
        uint8_t b = (color >> 8) & 0xFF;
        uint8_t a = color & 0xFF;

        std::ostringstream oss;
        oss << "#"
            << std::hex << std::uppercase << std::setfill('0')
            << std::setw(2) << static_cast<int>(r)
            << std::setw(2) << static_cast<int>(g)
            << std::setw(2) << static_cast<int>(b);
        if (a != 0xFF) {
            oss << std::setw(2) << static_cast<int>(a);
        }
        return oss.str();
    }
}
